﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.Common;
using Nova_DAL;


public partial class DelStorage_UnDelDataList : System.Web.UI.Page
{
    Nova_DAL.DbHelper access = new DbHelper();
    string strSQL = "";
    DbCommand cmd = null;
    DataSet ds = null;
    string strStockNo = "";
    string type = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            strStockNo = Request["strStockNo"].ToString();
            type = Request["type"].ToString();
        }
        catch (Exception ex)
        {
        }
        if (!IsPostBack)
        {
            bind(strStockNo);
        }
    }


    protected void bind(string strStockNo)
    {
        try
        {
            string Stno = strStockNo.Substring(0, 2);


            if (type == "出")
            {
                strSQL = "Select  TBM.Mat_Name,TBM.Mat_Code,TDS.StockNo,TDS.Num,ISNULL(TDS.Act_Num,0) AS Act_Num,TBM.S01,TBM.TM01,TBM.TM03,TBM.S02,TDS.S04,TDS.PID,TDS.TS01,TDS.S05 from TDelStorage_List TDS LEFT JOIN TBase_Material TBM ON TDS.Mat_Code = TBM.Mat_Code Where TDS.StockNo = '" + strStockNo + "'";
            }
            else if (type == "入")
            {
                strSQL = "Select  TBM.Mat_Name,TBM.Mat_Code,TDS.StockNo,TDS.Num,ISNULL(TDS.Act_Num,0) AS Act_Num,TBM.S01,TBM.TM01,TBM.TM03,TBM.S02,TDS.S04,TDS.PID,TDS.TS01,TDS.S05 from TAddStorage_List TDS LEFT JOIN TBase_Material TBM ON TDS.Mat_Code = TBM.Mat_Code Where TDS.StockNo = '" + strStockNo + "'";
            }

            cmd = access.GetSqlStringCommond(strSQL);
            gv.DataSource = access.ExecuteDataSet(cmd);
            gv.DataBind();

            Nova_Common.GrdvMerge.GroupRows(gv, 1);
        }
        catch (Exception ex)
        {

        }

    }

}